﻿using System.Web.Mvc;
using System.Web.Routing;
using Mefisto4.Core.MVC;

namespace Mefisto4
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            //Pas de routage pour ces élements
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");

            //Routes par défaut, ciblant les éléments centraux
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { module = "", controller = "Home", action = "Index", id = UrlParameter.Optional },
                constraints: new { controller = new ControllerExistenceContraint() },
                namespaces: new[] { "Mefisto4.Controllers" }
                );

            ////Routes fonctionnant pour l'administration du site
            //routes.MapRoute(
            //    name: "Admin",
            //    url: "Admin/{controller}/{action}/{id}",
            //    defaults: new { module = "", controller = "Home", action = "Index", id = UrlParameter.Optional },
            //    constraints: new { controller = new ControllerExistenceContraint() },
            //    namespaces: new[] { "Mefisto4.Areas.Admin.Controllers" }
            //    );

            //Routes fonctionnant pour les modules
            routes.MapRoute(
                name: "Modular",
                url: "{module}/{controller}/{action}/{id}",
                defaults: new { module = "", controller = "Home", action = "Index", id = UrlParameter.Optional },
                constraints: new { controller = new ControllerExistenceContraint() }
                );
        }
    }
}